<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
		<title>气泡三角形</title>
		<style type="text/css">
			/* Fonts */
@import "https://fonts.googleapis.com/css?family=Pacifico";
/* Variables for box and CSS triangles */
/* End Variables */
* {
  box-sizing: border-box;
}

html, body {
  min-height: 100%;
}

body {
  font-size: 16px;
}

header {
  font-family: 'Pacifico', cursive, Sans-Serif;
  font-size: 48px;
  color: #4d4d4d;
  text-align: center;
  margin: 45px 0 15px;
}
header span {
  display: block;
}
header small {
  font-size: 50%;
  color: #999999;
}

.wrapper {
  width: 620px;
  height: auto;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

/* box styles */
.box {
  width: 260px;
  height: 173.33333px;
  float: left;
  margin: 25px;
  background-color: #d66c5c;
  padding: 15px;
  border-radius: 3.25px;
  position: relative;
}
.box .triangle {
  width: 0;
  height: 0;
  position: absolute;
  z-index: 1;
  border-width: 13px;
  border-style: solid;
  border-color: transparent;
}
.box .triangle.top {
  border-bottom-color: #d66c5c;
  top: -26px;
  left: 50%;
  -webkit-transform: translateX(-50%);
          transform: translateX(-50%);
}
.box .triangle.right {
  border-left-color: #d66c5c;
  right: -26px;
  top: 50%;
  -webkit-transform: translateY(-50%);
          transform: translateY(-50%);
}
.box .triangle.bottom {
  border-top-color: #d66c5c;
  bottom: -26px;
  left: 50%;
  -webkit-transform: translateX(-50%);
          transform: translateX(-50%);
}
.box .triangle.left {
  border-right-color: #d66c5c;
  left: -26px;
  top: 50%;
  -webkit-transform: translateY(-50%);
          transform: translateY(-50%);
}

/* End of box */
/* CSS for p tags */
p {
  position: absolute;
  top: 0;
  left: 0;
  width: 260px;
  height: 173.33333px;
  text-align: center;
  line-height: 173.33333px;
  color: white;
  font-family: 'Pacifico', cursive, Sans-Serif;
  font-size: 36px;
  -webkit-transform: rotate(-5deg);
          transform: rotate(-5deg);
}

		</style>
	</head>
	<body>
		
		<header>
  <span>Easy & Simple CSS Triangles</span>
  <small>Instructions are within the HTML & CSS</small>
</header>

<section class="wrapper">
  
  <div class="box"> <!-- Make sure a parent element exists, with relative positioning, if you're going to be using a CSS triangle -->
    <span class="triangle bottom"></span> <!-- Simply set a span, or an element of your choosing, with the "triangle" class and also your chosen position as a class - E.g. "bottom" -->
    <p>Bottom</p>
  </div>

  <div class="box">
    <span class="triangle left"></span>
    <p>Left</p>
  </div>

  <div class="box">
    <span class="triangle right"></span>
    <p>Right</p>
  </div>

  <div class="box">
    <span class="triangle top"></span>
    <p>Top</p>
  </div>
  
</section>
	</body>
</html>
